home *** CD-ROM | disk | FTP | other *** search
- > --VB--
- > SELECT CASE Age
- > CASE < 10
- > print "You are less than 10 years old."
- > CASE = 21
- > print "Hey!! Now you can drink alcohol in the U.S.!!"
- > CASE > 21
- > print "WOW, You're OVER 21!!!"
- > END SELECT
- > --end--
-
- Never tried VB, but in C it's:
- switch(Expression) {
- case Constant:
- Do Your Stuff for this case here;
- break;
- case Constant:
- Do Your Stuff for this case here;
- of course, Your Stuff can extend across many lines,
- being a part of the case up until the "break"
- break;
- }
- Interesting that Visual Basic has apparently expanded on the
- switch...case style to allow case Expression instead of being limited
- to testing for equality.
-
- AMOS currently allows you to use the If conditional in a structured
- manner:
- If AGE<10
- Print "You are less than 10 years old."
- End If
- If AGE=21
- Print "Hey!! Now you can drink alcohol in the U.S.!!"
- End If
- If AGE>21
- Print "WOW, You're OVER 21!!!"
- End If
-
- As you can see that is very close to the style of your Select Case,
- the only drawback being that (in C at least), the switch statement
- is faster as it won't check every condition, so the equivalent AMOS
- code would be more like:
- If AGE<10
- Print "You are less than 10 years old."
- Else
- If AGE=21
- Print "Hey!! Now you can drink alcohol in the U.S.!!"
- Else
- If AGE>21
- Print "WOW, You're OVER 21!!!"
- End If
- End If
- End If
-
- This would be exactly the same as your select...case except the
- AMOS code is messier. Anyway, those are your two current
- choices: clarity with slower execution or messy with faster
- execution.
-
- Looks like AMOS needs support for those Select Cases as they
- give the best of both worlds: clarity and maximum speed. :-)
-
-
- Garfield Benjamin e-mail:gbenjam@sosbbs.com
- Website( http://www.sosbbs.com/~gbenjam ): 50% Complete
-
-